<template>
  <div>
    <h2>第三方库初始化</h2>
    <div class="chart"></div>
  </div>
</template>

<script setup lang="ts">
import * as echarts from 'echarts'
import { onMounted } from 'vue'

onMounted(() => {
  const chart = echarts.init(document.querySelector('.chart') as HTMLElement)
  const option = {
    title: {
      text: 'Echarts Example'
    },
    tooltip: {},
    xAxis: {
      data: ['Shirt', 'Cardigan', 'Chiffon', 'Pants', 'Heels', 'Socks']
    },
    yAxis: {},
    series: [
      {
        name: 'Slaes',
        type: 'bar',
        data: [5, 20, 36, 10, 10, 20]
      }
    ]
  }
  chart.setOption(option)
})
</script>

<style lang="scss" scoped>
.chart {
  width: 600px;
  height: 400px;
}
</style>
